package telas.componentes;

import javax.swing.FocusManager;
import javax.swing.JPasswordField;

public class CampoSenha extends JPasswordField 
{
	private static final long serialVersionUID = 4351645675569181178L;

	/**
	 * This method initializes 
	 * 
	 */
	public CampoSenha() 
	{
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() 
	{
        
		this.addKeyListener
	    (
	        new java.awt.event.KeyAdapter() 
	        {
	        	public void keyTyped(java.awt.event.KeyEvent e) 
	        	{
	        		verificaTecla(e);
	        	}
	        }
	     );
	}
	
	public void verificaTecla(java.awt.event.KeyEvent tecla)
	{
		// Se for a tecla <ENTER> passa para o proximo componente da tela
		if(tecla.getKeyChar() == '\n')
		{
			FocusManager.getCurrentManager().focusNextComponent();
		}
	}

}
